SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
-- =============================================
-- Author:		Paulo Fournier
-- Create date: 2013-01-27
-- Description:	Remover categora
-- =============================================
CREATE PROCEDURE ext.removerCategoria
	-- Add the parameters for the stored procedure here
	@id_categoria INT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	IF((SELECT COUNT(*) FROM ext.evento WHERE id_categoria = @id_categoria) > 0)
	BEGIN
		SELECT CAST(0 AS BIT) AS RST;
	END
	ELSE
	BEGIN
		DELETE FROM ext.categoria WHERE id_categoria = @id_categoria;
		SELECT CAST(1 AS BIT) AS RST;
	END
	
END
GO
